//
//  RPDBManage.h
//  renphoApp
//
//  Created by Simon on 2020/11/6.
//

#import <FMDB/FMDB.h>
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 db升级到dbQueue,兼容旧代码
 */
/*
@interface RPDatabaseQueue : FMDatabaseQueue

- (BOOL)open;
- (BOOL)executeUpdate:(NSString *)sql, ...;
- (FMResultSet *)executeQuery:(NSString *)sql, ...;
- (BOOL)columnExists:(NSString *)columnName inTableWithName:(NSString *)tableName;
- (NSError *)lastError;

@end */

/**
 RP数据库单例
 */
@interface RPDBManage : NSObject

+ (instancetype)share;
+ (void)remove;
// db路径
@property(nonatomic, strong, readonly) NSString *dbPath;
// dbQueue(以前为FMDatabase,5.2.0升级为RPDatabaseQueue)
@property(nonatomic, weak, readonly) FMDatabase *fmdb;
// db
@property(nonatomic, strong, readonly) FMDatabaseQueue *fmdbQueue;

- (void)updateUserName:(NSString *)userName state:(BOOL)state;

- (BOOL)queryUserName:(NSString *)userName;

- (void)deleteData;
@end

NS_ASSUME_NONNULL_END
